home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / samples / innlog.awk < prev    next >
Text File  |  1993-01-29  |  38KB  |  1,569 lines

  1. ##  $Revision: 1.7 $
  2. ##  @(#) newsinfo.awk    falcon@cats.ucsc.edu (jon r. luini)    7/4/92
  3. ##  Modified by Robert Elz to understand more reports.
  4. ##  Modified by Rich $alz for consistent formatting.
  5. ##  Modified by Chris Schmidt to sort output.
  6. BEGIN {
  7.     unknowns = 0;
  8.     batcher = 0;
  9.     client_timeout = 0;
  10.     ctlinnd_new = 0;
  11.     ctlinnd_rmg = 0;
  12.     ctlinnd_seen = 0;
  13.     innd = 0;
  14.     innd_bad_ihaves = 0;
  15.     innd_bad_msgids = 0;
  16.     innd_bad_sendmes = 0;
  17.     innd_blockeds = 0;
  18.     innd_change_groups = 0;
  19.     innd_newgroups = 0;
  20.     innd_pauses = 0;
  21.     innd_points = 0;
  22.     innd_reloads = 0;
  23.     innd_restarts = 0;
  24.     innd_rmgroups = 0;
  25.     innd_shutdowns = 0;
  26.     innd_throttles = 0;
  27.     innxmit = 0;
  28.     invalid = "~~~~~~~~~~~~~~~~~~~~~~~~"
  29.     mthreads = 0;
  30.     mthreads_added = 0;
  31.     mthreads_expired = 0;
  32.     mthreads_started = 0;
  33.     mthreads_turned_off = 0;
  34.     mthreads_turned_on = 0;
  35.     nnrp = 0;
  36.     nnrp_gethostfails = 0;
  37.     nnrp_noperms = 0;
  38.     nnrp_readers = 0;
  39.     nnrp_unrecs = 0;
  40.     nntplink = 0;
  41.     rnews_bad = 0;
  42.     rnews_bad_date = 0;
  43.     rnews_bad_dist = 0;
  44.     rnews_bad_ng = 0;
  45.     rnews_host = 0;
  46.     rnews_host = 0;
  47.     rnews_rejects = 0;
  48.     server_timeout = 0;
  49.  
  50.     ctlinnd["a"] = "addhist";
  51.     ctlinnd["D"] = "allow";
  52.     ctlinnd["b"] = "begin";
  53.     ctlinnd["c"] = "cancel";
  54.     ctlinnd["u"] = "changegroup";
  55.     ctlinnd["d"] = "checkfile";
  56.     ctlinnd["e"] = "drop";
  57.     ctlinnd["f"] = "flush";
  58.     ctlinnd["g"] = "flushlogs";
  59.     ctlinnd["h"] = "go";
  60.     ctlinnd["i"] = "hangup";
  61.     ctlinnd["s"] = "mode";
  62.     ctlinnd["j"] = "name";
  63.     ctlinnd["k"] = "newgroup";
  64.     ctlinnd["l"] = "param";
  65.     ctlinnd["m"] = "pause";
  66.     ctlinnd["v"] = "readers";
  67.     ctlinnd["t"] = "refile";
  68.     ctlinnd["C"] = "reject";
  69.     ctlinnd["o"] = "reload";
  70.     ctlinnd["n"] = "renumber";
  71.     ctlinnd["z"] = "reserve";
  72.     ctlinnd["p"] = "rmgroup";
  73.     ctlinnd["A"] = "send";
  74.     ctlinnd["q"] = "shutdown";
  75.     ctlinnd["B"] = "signal";
  76.     ctlinnd["r"] = "throttle";
  77.     ctlinnd["w"] = "trace";
  78.     ctlinnd["x"] = "xabort";
  79.     ctlinnd["y"] = "xexec";
  80. }
  81.  
  82.  
  83. ##
  84. ##  SYSLOG
  85. ##
  86. $5 == "last" && $6 == "message" && $7 == "repeated" {
  87.     ## Skip.
  88.     next;
  89. }
  90.  
  91.  
  92. ##
  93. ##  NNRP
  94. ##
  95. $5 ~ /nnrpd.*/ {
  96.     host = $6;
  97.  
  98.     if ($7 == "connect") {
  99.     nnrp_connect[host]++;
  100.     nnrp = 1;
  101.     next;
  102.     }
  103.  
  104.     if ($7 == "exit") {
  105.     nnrp_articles[host] += $9;
  106.     nnrp_groups[host] += $11;
  107.     next;
  108.     }
  109.  
  110.     if ($7 == "posts") {
  111.     nnrp_posts[host] += $9;
  112.     nnrp_rejected[host] += $11;
  113.     next;
  114.     }
  115.  
  116.     if ($7 == "times") {
  117.     nnrp_times_user[host] += $9;
  118.     nnrp_times_sys[host] += $11;
  119.     nnrp_times_elapsed[host] += $13;
  120.     next;
  121.     }
  122.  
  123.     if ($7 == "group") {
  124.     nnrp_readers = 1;
  125.     nnrp_group_request[$8]++;
  126.     next;
  127.     }
  128.  
  129.     if ($7 == "post") {
  130.     ##  Skip; handled in "posts" above.
  131.     next;
  132.     }
  133.  
  134.     if ($7 == "unrecognized") {
  135.     nnrp_unrecs = 1;
  136.     nnrp_unrec[host]++;
  137.     next;
  138.     }
  139.  
  140.     if ($7 == "no_permission") {
  141.     nnrp_noperms = 1;
  142.     nnrp_noperm[host]++;
  143.     next;
  144.     }
  145.  
  146.     if ($7 == "timeout") {
  147.     client_timeout = 1;
  148.     nnrp_timeout[host]++;
  149.     next;
  150.     }
  151.  
  152.     if ($6 == "gethostbyaddr:") {
  153.     nnrp_gethostfails = 1;
  154.     nnrp_gethostfail[$7]++;
  155.     next;
  156.     }
  157.  
  158.     if ($7 == "cant" && $8 == "gethostbyaddr") {
  159.     ##  Skip; handled in "gethostbyaddr:" above.
  160.     next;
  161.     }
  162. }
  163.  
  164.  
  165. ##
  166. ## INND
  167. ##
  168. $5 == "innd:" {
  169.     innd = 1;
  170.     if ( $6 ~ /^[a-zA-Z]:.*/ || $6 ~ /^[dgs]$/ ) {
  171.     ##  A ctlinnd command.
  172.     ##  Note that the last parameter in $6 may be continued in $7 etc
  173.     n = split($6, ctl, ":");
  174.     if (ctlinnd[ctl[1]] == "") {
  175.         ##  Unknown; update this script!
  176.         print;
  177.         next;
  178.     }
  179.     ctlinnd_type[ctl[1]]++;
  180.     ctlinnd_seen++;
  181.  
  182.     if (ctl[1] == "k") {
  183.         ##  Newgroup.  Process it here so we can get the creator.
  184.         ctlinnd_new++;
  185.         ctlinnd_newgroups[ctl[2]] = ctl[4];
  186.         next;
  187.     }
  188.     if (ctl[1] == "p") {
  189.         ##  Rmgroup.  Process it here for symmetry.
  190.         ctlinnd_rmg++;
  191.         ctlinnd_rmgroups[ctl[2]] = 1;
  192.         next;
  193.     }
  194.  
  195.     ## Skip others for now.
  196.     next;
  197.     }
  198.  
  199.     if ( $6 ~ /.*:.*/ ) {
  200.     n = split($6, path, ":");
  201.     host = path[1];
  202.     }
  203.     else
  204.     host = $6;
  205.  
  206.     if ($7 == "connected") {
  207.     ##  Account for the fact that innd says "local connected ##"
  208.     ##  and then "localhost:## closed"
  209.     if (host == "local") {
  210.         host = "localhost";
  211.     }
  212.     innd_connect[host]++;
  213.     next;
  214.     }
  215.  
  216.     if ($7 == "closed") {
  217.     innd_seconds[host] += $9;
  218.     innd_accepted[host] += $11;
  219.     innd_refused[host] += $13;
  220.     innd_rejected[host] += $15;
  221.     innd_chkp[host] = 0;
  222.     if (cp_innd_chkp[host] == 1) {
  223.         cp_innd_chkp[host] = 0;
  224.         innd_points--;
  225.     }
  226.     next;
  227.     }
  228.     if ($7 == "checkpoint") {
  229.     cp_innd_seconds[host] = $9;
  230.     cp_innd_accepted[host] = $11;
  231.     cp_innd_refused[host] = $13;
  232.     cp_innd_rejected[host] = $15;
  233.     if (cp_innd_chkp[host] == 0) {
  234.         cp_innd_chkp[host] = 1;
  235.         innd_points++;
  236.     }
  237.     next;
  238.     }
  239.  
  240.     if ($6 ~ /\/.*/) {
  241.     ##  Skip; handled by "opened/spawned" below.
  242.     next;
  243.     }
  244.  
  245.     if ($7 == "flush") {
  246.     innd_flush[host]++;
  247.     next;
  248.     }
  249.  
  250.     if ($7 == "timeout") {
  251.     innd_timeout[host]++;
  252.     next;
  253.     }
  254.  
  255.     if ($7 == "opened" || $7 == "spawned") {
  256.     n = split($8, blarg, ":");
  257.     innd_feed[host] = blarg[n];
  258.     next;
  259.     }
  260.  
  261.     if ($7 == "newgroup") {
  262.     innd_newgroups++;
  263.     next;
  264.     }
  265.  
  266.     if ($7 == "rmgroup") {
  267.     innd_rmgroups++;
  268.     next;
  269.     }
  270.  
  271.     if ($7 == "paused") {
  272.     innd_pauses++;
  273.     next;
  274.     }
  275.  
  276.     if ($7 == "throttled") {
  277.     innd_throttles++;
  278.     next;
  279.     }
  280.  
  281.     if ($7 == "reload") {
  282.     innd_reloads++;
  283.     next;
  284.     }
  285.  
  286.     if ($7 == "change_group") {
  287.     innd_change_groups++;
  288.     next;
  289.     }
  290.  
  291.     if ($7 == "shutdown") {
  292.     innd_shutdowns++;
  293.     next;
  294.     }
  295.  
  296.     if ($7 == "starting") {
  297.     innd_restarts++;
  298.  
  299.     if (innd_points != 0) {
  300.         ##  Unfinished checkpoints from before; something crashed.
  301.         for (s in cp_innd_chkp) {
  302.         if (cp_innd_chkp[s] == 0)
  303.             continue;
  304.         innd_seconds[s] += cp_innd_seconds[s];
  305.         innd_accepted[s] += cp_innd_accepted[s];
  306.         innd_refused[s] += cp_innd_refused[s];
  307.         innd_rejected[s] += cp_innd_rejected[s];
  308.         cp_innd_chkp[s] = 0;
  309.         }
  310.         innd_points = 0;
  311.     }
  312.     next;
  313.     }
  314.  
  315.     if ($7 == "bad_ihave") {
  316.     innd_bad_ihave[host]++;
  317.     innd_bad_ihaves = 1;
  318.     next;
  319.     }
  320.  
  321.     if ($7 == "ihave_from_me") {
  322.     next;
  323.     }
  324.  
  325.     if ($7 == "bad_messageid") {
  326.     innd_bad_msgid[host]++;
  327.     innd_bad_msgids = 1;
  328.     next;
  329.     }
  330.  
  331.     if ($7 == "bad_sendme") {
  332.     innd_bad_sendme[host]++;
  333.     innd_bad_sendmes = 1;
  334.     next;
  335.     }
  336.  
  337.     if ($7 == "blocked" && $8 == "sleeping") {
  338.     innd_blocked[host]++;
  339.     innd_blockeds = 1;
  340.     next;
  341.     }
  342.  
  343.     if ($7 == "exit" && $8 == "0") {
  344.     ##  Program or process finished normally; don't care.
  345.     next;
  346.     }
  347.  
  348.     if ($7 == "wakeup" || ($7 == "cant" && ($8 == "write" || $8 == "read"))) {
  349.     ##  Skip; handled by "blocked/sleeping" above.
  350.     next;
  351.     }
  352.  
  353.     if ($7 == "inactive"    || $7 == "descriptors"    \
  354.      || $7 == "outgoing"    || $7 == "running"    \
  355.      || $7 == "lcsetup"        || $7 == "ccsetup"    \
  356.      || $7 == "rcsetup"        || $7 == "readclose"    \
  357.      || $7 == "flush_all"    \
  358.     ) {
  359.     ##  Skip; for now.
  360.     next;
  361.     }
  362. }
  363.  
  364.  
  365. ##
  366. ##  BATCHER
  367. ##
  368. $5 ~ /batcher.*/ {
  369.     host = $7;
  370.  
  371.     ## Since times lines are always followed by stats lines, we
  372.     ## only do the batcher_site[host]++ and batcher=1 once
  373.     if ($8 == "times") {
  374.     batcher_times_user[host] += $10;
  375.     batcher_times_sys[host] += $12;
  376.     batcher_times_elapsed[host] += $14;
  377.     batcher_site[host]++;
  378.     batcher = 1;
  379.     next;
  380.     }
  381.  
  382.     if ($8 == "stats") {
  383.     batcher_num[host] += $10;
  384.     batcher_articles[host] += $12;
  385.     batcher_bytes[host] += $14;
  386.     next;
  387.     }
  388. }
  389.  
  390.  
  391. ##
  392. ##  INNXMIT
  393. ##
  394. $5 ~ /innxmit.*/ {
  395.     if ( $6 ~ /:/ ) {
  396.     n = split($6, path, ":");
  397.     host = path[1];
  398.     }
  399.     else
  400.     host = $6;
  401.  
  402.     if ($7 == "ihave" && $8 == "failed") {
  403.     ## ihave failed occurs when the server rejects an article,
  404.     ## and requests it to be resent at the ihave stage - this
  405.     ## always indicates a server problem (all it has of the article
  406.     ## is its message-id) most commonly "out of space" - in that
  407.     ## case we don't really want to count this as an offered
  408.     ## article, so remember this happened so we can reduce the
  409.     ## offered count below.
  410.  
  411.     innxmit_ihfail[host] = 1;
  412.  
  413.     if ($9 == "436" && $11 == "NNTP" && $13 == "out" && $15 ~ /space/) {
  414.         innxmit_nospace[host]++;
  415.         next;
  416.     }
  417.     }
  418.  
  419.     ## Since stats lines are always followed by times lines we
  420.     ## only do the innxmit_site[host]++ and innxmit=1 once
  421.     if ($7 == "stats") {
  422.     innxmit_offered[host] += $9 - innxmit_ihfail[host];
  423.     innxmit_accepted[host] += $11;
  424.     innxmit_rejected[host] += $13;
  425.     innxmit_failed[host] += $15;
  426.     innxmit_ihfail[host] = 0;
  427.     innxmit_site[host]++;
  428.     innxmit = 1;
  429.     next;
  430.     }
  431.  
  432.     if ($7 == "times") {
  433.     innxmit_times_user[host] += $9;
  434.     innxmit_times_sys[host] += $11;
  435.     innxmit_times_elapsed[host] += $13;
  436.     next;
  437.     }
  438.  
  439.     if ($7 == "requeued") {
  440.     r = $9;
  441.     for (i = 10; i < NF; i++)
  442.         r = r " " $i;
  443.     innxmit_reQ_host[host]++;
  444.     innxmit_reQ_reason[r]++;
  445.     next;
  446.     }
  447.  
  448.     if ($7 == "connect" && $9 == "400" \
  449.      && (($10 == "No" && $11 == "space") \
  450.        || ($11 == "NNTP" && $13 == "out" && $15 ~ /space/))) {
  451.     ##  There is no startup marked for this.
  452.     innxmit_site[host]++;
  453.     innxmit_nospace[host]++;
  454.     next;
  455.     }
  456.  
  457.     if ($7 == "connect" && $9 == "400" && $10 == "loadav") {
  458.     ##  There is no startup marked for this.
  459.     innxmit_site[host]++;
  460.     innxmit_hiload[host]++;
  461.     next;
  462.     }
  463.  
  464.     if ($7 == "connect" && $9 == "400" && $0 ~ /[Ee][Xx][Pp][Ii][Rr]/) {
  465.     ##  There is no startup marked for this.
  466.     innxmit_site[host]++;
  467.     innxmit_expire[host]++;
  468.     next;
  469.     }
  470.  
  471.     if ($7 == "connect" && $9 == "400") {
  472.     ##  There is no startup marked for this.
  473.     innxmit_site[host]++;
  474.     innxmit_crefused[host]++;
  475.     next;
  476.     }
  477.  
  478.     if ($7 == "connect" && $8 == "failed") {
  479.     ##  There is no startup marked for this.
  480.     innxmit_site[host]++;
  481.     innxmit_cfail_host[host]++;
  482.  
  483.     ##  Later, maybe.
  484.     #r = $9;
  485.     #for (i = 10; i < NF; i++)
  486.     #    r = r " " $i;
  487.     #innxmit_cfail_reason[r]++;
  488.     next;
  489.     }
  490.  
  491.     if ($7 == "authenticate" && $8 == "failed") {
  492.     ##  There is no startup marked for this.
  493.     innxmit_site[host]++;
  494.     innxmit_afail_host[host]++;
  495.  
  496.     ##  Later, maybe.
  497.     #r = $9;
  498.     #for (i = 10; i < NF; i++)
  499.     #    r = r " " $i;
  500.     #innxmit_afail_reason[r]++;
  501.     next;
  502.     }
  503. }
  504.  
  505. $5 ~ /rnews.*/ {
  506.     if ($6 == "rejected") {
  507.     if ($7 == "connection") {
  508.         rnews_rejects++;
  509.         i = 8;
  510.         if ($8 == "400")
  511.         i++;
  512.         n = $i;
  513.         for (i++; i <= NF; i++)
  514.         n = n " " $i;
  515.         rnews_r_reject[n]++;
  516.         next;
  517.     }
  518.     if ($7 == "437") {
  519.         rnews_bad++;
  520.         if ($8 == "Unwanted" && $9 == "newsgroup") {
  521.         rnews_bad_ng++;
  522.         rnews_bng[$10]++;
  523.         next;
  524.         }
  525.         if ($8 == "Unwanted" && $9 == "distribution") {
  526.         rnews_bad_dist++;
  527.         rnews_bdist[$10]++;
  528.         next;
  529.         }
  530.         if ($8 == "Bad" && $9 == "\"Date\"") {
  531.         rnews_bad_date++;
  532.         next;
  533.         }
  534.     }
  535.     }
  536.     if ($6 == "offered") {
  537.     rnews_hosts[$8]++;
  538.     rnews_host = 1;
  539.     next;
  540.     }
  541. }
  542.  
  543.  
  544. ##
  545. ##  NNTPLINK
  546. ##
  547. $5 ~ /.*nntplink.*/ {
  548.     if ( $6 ~ /:/ ) {
  549.     n = split($6, path, ":");
  550.     host = path[1];
  551.     }
  552.     else
  553.     host = $6;
  554.  
  555.     if ($7 == "EOF") {
  556.     ##  There is no startup marked for this.
  557.     nntplink_site[host]++;
  558.     nntplink_eof[host]++;
  559.     next;
  560.     }
  561.  
  562.     if ($10 == "Broken" && $11 == "pipe") {
  563.     ##  There is no startup marked for this.
  564.     nntplink_site[host]++;
  565.     nntplink_bpipe[host]++;
  566.     next;
  567.     }
  568.  
  569.     if ($7 == "greeted" && $10 == "400" \
  570.      && (($11 == "No" && $12 == "space") \
  571.        || ($12 == "NNTP" && $14 == "out" && $16 ~ /space/))) {
  572.     ##  There is no startup marked for this.
  573.     nntplink_site[host]++;
  574.     nntplink_nospace[host]++;
  575.     next;
  576.     }
  577.  
  578.     if ($7 == "greeted" && $10 == "400" && $11 == "loadav") {
  579.     ##  There is no startup marked for this.
  580.     nntplink_site[host]++;
  581.     nntplink_hiload[host]++;
  582.     next;
  583.     }
  584.  
  585.     if ($7 == "greeted" && $10 == "400" && $0 ~ /[Ee][Xx][Pp][Ii][Rr]/) {
  586.     ##  There is no startup marked for this.
  587.     nntplink_site[host]++;
  588.     nntplink_expire[host]++;
  589.     next;
  590.     }
  591.  
  592.     if ($7 == "greeted" && $10 == "400") {
  593.     ##  Some other failure, or innd throttle for some local reason.
  594.     ##  There is no startup marked for this.
  595.     nntplink_site[host]++;
  596.     nntplink_fail[host]++;
  597.     next;
  598.     }
  599.  
  600.     if ($7 == "socket():") {
  601.     ##  There is no startup marked for this.
  602.     nntplink_site[host]++;
  603.     nntplink_sockerr[host]++;
  604.     next;
  605.     }
  606.  
  607.     if ($7 == "connection" && $8 == "timed" && $9 == "out") {
  608.     ##  There is no startup marked for this.  Fake reason.
  609.     nntplink_bpipe[host]++;
  610.     nntplink_site[host]++;
  611.     next;
  612.     }
  613.  
  614.     if ($7 == "sent" && $8 == "authinfo" && $10 == "exiting") {
  615.     ##  There is no startup marked for this.
  616.     nntplink_site[host]++;
  617.     nntplink_auth[host]++;
  618.     }
  619.  
  620.     if ($7 == "sent" && $8 == "IHAVE") {
  621.     ##  An "ihave failure":  site rejected the article after the
  622.     ##  IHAVE command; most likely it was out of space.  Don't
  623.     ##  count this as an offered article, so remember it.  Since
  624.     ##  nntplink keeps trying to send we could get many such
  625.     ##  failures in a single connection.  For counting purposes
  626.     ##  we pretend that there were several separate connections.
  627.     nntplink_ihfail[host]++;
  628.  
  629.     if ($11 == "436" && $13 == "NNTP" && $15 == "out" && $17 ~ /space/) {
  630.         nntplink_fake_connects[host]++;
  631.         nntplink_nospace[host]++;
  632.         next;
  633.     }
  634.     }
  635.  
  636.     ## Since stats lines are always followed by xmit lines, we
  637.     ## only do the nntplink_site[host]++ and nntplink=1 once
  638.     if ($7 == "stats") {
  639.     nntplink_offered[host] += $8 - nntplink_ihfail[host];
  640.     nntplink_accepted[host] += $10;
  641.     nntplink_rejected[host] += $12;
  642.     nntplink_failed[host] += $14;
  643.     nntplink_ihfail[host] = 0;
  644.     if (nntplink_fake_connects[host]) {
  645.         nntplink_site[host] += nntplink_fake_connects[host];
  646.         nntplink_fake_connects[host] = 0;
  647.     } else {
  648.         nntplink_site[host]++;
  649.     }
  650.     nntplink = 1;
  651.     next;
  652.     }
  653.  
  654.     if ($7 == "xmit") {
  655.     nntplink_times_user[host] += $9;
  656.     nntplink_times_sys[host] += $11;
  657.     nntplink_times_elapsed[host] += $13;
  658.     next;
  659.     }
  660.  
  661.     if ($7 == "xfer") {
  662.     ##  We can compute this if we need it, but there isn't
  663.     ##  space in the output table for it
  664.     #nntplink_offer_min[host] += $9;
  665.     #nntplink_accept_min[host] += $11;
  666.     next;
  667.     }
  668.  
  669.     ##  503 is the code for timeouts.
  670.     if ($11 == "503" || $12 == "Timeout") {
  671.     nntplink_timeout[host]++;
  672.     timeout = 1;
  673.     next;
  674.     }
  675. }
  676.  
  677.  
  678. ##
  679. ##  NNTPD
  680. ##
  681. $5 ~ /nntpd.*/ {
  682.     if ( $6 ~ /.*:.*/ ) {
  683.     n = split($6, path, ":");
  684.     host = path[1];
  685.     }
  686.     else
  687.     host = $6;
  688.  
  689.     if ($7 == "connect") {
  690.     nntpd_connect[host]++;
  691.     nntpd = 1;
  692.     next;
  693.     }
  694.  
  695.     if ($7 == "times") {
  696.     nntpd_seconds[host] += $9 + $11;
  697.     nntpd_elapsed[host] += $13;
  698.     if (nntpd_connect[host] == 0)
  699.         nntpd_connect[host]++;
  700.     nntpd_done[host]++;
  701.     next;
  702.     }
  703.  
  704.     if ($7 == "ihave_stats") {
  705.     nntpd_accepted[host] += $9;
  706.     nntpd_refused[host] += $11;
  707.     nntpd_rejected[host] += $13;
  708.     next;
  709.     }
  710.  
  711.     if ($7 == "no" && $8 == "space") {
  712.     nntpd_nospace[host]++;
  713.     if (nntpd_connect[host] == 0)
  714.         nntpd_connect[host]++;
  715.     nntpd_done[host]++;
  716.     next;
  717.     }
  718.  
  719.     if ($6 == "no" && $7 == "space")
  720.     next;
  721.  
  722.     ##  Rest is likely to be reader stuff; skip for now.
  723. }
  724.  
  725.  
  726.  
  727. ##
  728. ##  MTHREADS
  729. ##
  730. $5 ~ /mthreads.*/ {
  731.  
  732.     if ($6 == "Started" && $7 == "mthreads") {
  733.     mthreads = 1;
  734.     mthreads_started++;
  735.     next;
  736.     }
  737.  
  738.     if ($6 == "Processed" && $9 == "added" && $12 == "expired") {
  739.     mthreads = 1;
  740.     mthreads_added += $10;
  741.     mthreads_expired += $13;
  742.     next;
  743.     }
  744.  
  745.     if ($6 == "Turned" && $8 == "groups" && $9 == "on.") {
  746.     mthreads = 1;
  747.     mthreads_turned_on += $7;
  748.     next;
  749.     }
  750.  
  751.     if ($6 == "Turned" && $8 == "groups" && $9 == "off.") {
  752.     mthreads = 1;
  753.     mthreads_turned_off += $7;
  754.     next;
  755.     }
  756. }
  757.  
  758.  
  759. ##
  760. ##  UNKNOWN
  761. ##
  762. {
  763.     if (unknowns == 0) {
  764.     printf("Unknown entries from news log file:\n");
  765.     unknowns = 1;
  766.     }
  767.     print;
  768. }
  769.  
  770.  
  771. ##
  772. ##  SUMMARIZE DATA
  773. ##  NOTE: the following are collected but not used right now:
  774. ##    innd_flush
  775. ##    innd_feed
  776. ##    innd_pauses
  777. ##    innd_throttles
  778. ##    innd_newgroups
  779. ##    innd_rmgroups
  780. ##    innd_reloads
  781. ##    innd_timeout
  782. ##    innd_change_groups
  783. ##
  784. END {
  785.     printf("\n");
  786.     if (innd) {
  787.     ##  INND control statistics.
  788.     if (ctlinnd_seen) {
  789.         printf("Control commands to INND\t(%d total)\n\n", ctlinnd_seen);
  790.         i = 0;
  791.         for (m in ctlinnd_type) {
  792.         printf("\t%13s %4d", ctlinnd[m], ctlinnd_type[m]);
  793.         if (++i == 3) {
  794.             i = 0;
  795.             printf("\n");
  796.         }
  797.         }
  798.         if (i != 0)
  799.         printf("\n");
  800.         printf("\n");
  801.  
  802.         if (ctlinnd_new) {
  803.         printf("Newsgroups created:\n");
  804.         for (m in ctlinnd_newgroups)
  805.             printf("\t%-30.30s by %s\n", m, ctlinnd_newgroups[m]);
  806.         printf("\n");
  807.         }
  808.  
  809.         if (ctlinnd_rmg) {
  810.         printf("Newsgroups removed:\n");
  811.         for (m in ctlinnd_rmgroups)
  812.             printf("\t%s\n", m);
  813.         printf("\n");
  814.         }
  815.     }
  816.  
  817.     ##  INND exchange statistics.
  818.     printf("Articles received by server\n");
  819.     printf("System            Connects  Offered   Took Refuse Rejct Accpt   Elapsed\n");
  820.     for ( ; ; ) {
  821.         s = invalid;
  822.         for (sortindex in innd_connect)
  823.         if (innd_connect[sortindex] >= 0 && sortindex < s)
  824.             s = sortindex;
  825.         if (s == invalid)
  826.         break;
  827.  
  828.         ninnd_connect += innd_connect[s];
  829.         ninnd_accept += innd_accepted[s];
  830.         ninnd_refuse += innd_refused[s];
  831.         ninnd_reject += innd_rejected[s];
  832.         ninnd_ela += innd_seconds[s];
  833.         offered = innd_accepted[s] + innd_refused[s] + innd_rejected[s];
  834.         ninnd_offered += offered;
  835.         if (offered == 0)
  836.         offered = 1;
  837.         percent_accpt = (innd_accepted[s] * 100) / offered;
  838.         e_hours      = innd_seconds[s] / 3600;
  839.         e_sec        = innd_seconds[s] % 3600;
  840.         e_min        = e_sec / 60;
  841.         e_sec        %= 60;
  842.  
  843.         printf("%-20.20s %5d   %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n", \
  844.         s, innd_connect[s], \
  845.         innd_accepted[s] + innd_refused[s] + innd_rejected[s], \
  846.         innd_accepted[s], innd_refused[s], innd_rejected[s], \
  847.         percent_accpt, e_hours, e_min, e_sec);
  848.  
  849.             innd_connect[s] = -1;
  850.     }
  851.  
  852.     e_hours      = ninnd_ela / 3600;
  853.     e_sec        = ninnd_ela % 3600;
  854.     e_min        = e_sec / 60;
  855.     e_sec        %= 60;
  856.     they_offered = ninnd_offered;
  857.     if (they_offered == 0)
  858.         they_offered = 1;
  859.     percent_accpt = (ninnd_accept * 100.0)/ (they_offered + 0.1);
  860.  
  861.     printf("\n%-20s %5d   %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n\n", \
  862.         "TOTALS", ninnd_connect, ninnd_offered, ninnd_accept, \
  863.         ninnd_refuse, ninnd_reject, percent_accpt, e_hours, e_min, \
  864.         e_sec);
  865.     }
  866.  
  867.     ##  Miscellaneous innd statistics.
  868.     if (innd_bad_msgids) {
  869.     printf("Bad Message-ID's offered\n");
  870.     for ( ; ; ) {
  871.         s = invalid;
  872.         for (sortindex in innd_bad_msgid)
  873.         if (innd_bad_msgid[sortindex] >= 0 && sortindex < s)
  874.             s = sortindex;
  875.         if (s == invalid)
  876.         break;
  877.  
  878.         printf("%-20.20s %5d\n", s, innd_bad_msgid[s]);
  879.  
  880.         innd_bad_msgid[s] = -1;
  881.         }
  882.     printf("\n");
  883.     }
  884.     if (innd_bad_ihaves) {
  885.     printf("Bad ihave control messages received\n");
  886.     for ( ; ; ) {
  887.         s = invalid;
  888.         for (sortindex in innd_bad_ihave)
  889.             if (innd_bad_ihave[sortindex] >= 0 && sortindex < s)
  890.             s = sortindex;
  891.             if (s == invalid)
  892.         break;
  893.  
  894.         printf("%-20.20s %5d\n", s, innd_bad_ihave[s]);
  895.  
  896.         innd_bad_ihave[s] = -1;
  897.         }
  898.     printf("\n");
  899.     }
  900.     if (innd_bad_sendmes) {
  901.     printf("Ignored sendme control messages received\n");
  902.     for ( ; ; ) {
  903.         s = invalid;
  904.         for (sortindex in innd_bad_sendme)
  905.         if (innd_bad_sendme[sortindex] >= 0 && sortindex < s)
  906.             s = sortindex;
  907.             if (s == invalid)
  908.         break;
  909.  
  910.         printf("%-20.20s %5d\n", s, innd_bad_sendme[s]);
  911.  
  912.         innd_bad_sendme[s] = -1;
  913.         }
  914.     printf("\n");
  915.     }
  916.     if (innd_blockeds) {
  917.     printf("Blocked server feeds\n");
  918.     for ( ; ; ) {
  919.         s = invalid;
  920.         for (sortindex in innd_blocked)
  921.         if (innd_blocked[sortindex] >= 0 && sortindex < s)
  922.             s = sortindex;
  923.             if (s == invalid)
  924.         break;
  925.  
  926.         printf("%-20.20s %5d\n", s, innd_blocked[s]);
  927.  
  928.         innd_blocked[s] = -1;
  929.         }
  930.     printf("\n");
  931.     }
  932.  
  933.     ##  NNTPD statistics.
  934.     if (nntpd) {
  935.     printf("Articles received by NNTPD\n");
  936.     printf("System            Connects NSpc Fail Offered  Took Refuse Rejct Accpt   Elapsed\n");
  937.     for ( ; ; ) {
  938.         s = invalid;
  939.         for (sortindex in nntpd_connect)
  940.         if (nntpd_connect[sortindex] >= 0 && sortindex < s)
  941.             s = sortindex;
  942.             if (s == invalid)
  943.         break;
  944.  
  945.         nnntpd_connect += nntpd_connect[s];
  946.         nnntpd_nospace += nntpd_nospace[s];
  947.         nnntpd_accept += nntpd_accepted[s];
  948.         nnntpd_refuse += nntpd_refused[s];
  949.         nnntpd_reject += nntpd_rejected[s];
  950.         nnntpd_ela += nntpd_elapsed[s];
  951.         nnntpd_done += nntpd_done[s];
  952.         offered = nntpd_accepted[s] + nntpd_refused[s] + nntpd_rejected[s];
  953.         nnntpd_offered += offered;
  954.         if (offered == 0)
  955.         offered = 1;
  956.         percent_accpt = (nntpd_accepted[s] * 100) / offered;
  957.         e_hours      = nntpd_elapsed[s] / 3600;
  958.         e_sec        = nntpd_elapsed[s] % 3600;
  959.         e_min        = e_sec / 60;
  960.         e_sec        %= 60;
  961.  
  962.         printf("%-20.20s %5d %4d %4d %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n", \
  963.         s, nntpd_connect[s], nntpd_nospace[s], \
  964.         nntpd_connect[s] - nntpd_done[s], \
  965.         nntpd_accepted[s] + nntpd_refused[s] + nntpd_rejected[s], \
  966.         nntpd_accepted[s], nntpd_refused[s], nntpd_rejected[s], \
  967.         percent_accpt, e_hours, e_min, e_sec);
  968.  
  969.             nntpd_connect[s] = -1;
  970.     }
  971.  
  972.     e_hours      = nnntpd_ela / 3600;
  973.     e_sec        = nnntpd_ela % 3600;
  974.     e_min        = e_sec / 60;
  975.     e_sec        %= 60;
  976.     they_offered = nnntpd_offered;
  977.     if (they_offered == 0)
  978.         they_offered = 1;
  979.     percent_accpt = (nnntpd_accept * 100.0)/ (they_offered + 0.1);
  980.  
  981.     printf("\n%-20s %5d %4d %4d %6d %6d %6d %5d  %3d%% %3d:%02d:%02d\n\n", \
  982.         "TOTALS", nnntpd_connect, nnntpd_nospace, \
  983.         nnntpd_connect - nnntpd_done, \
  984.         nnntpd_offered, nnntpd_accept, nnntpd_refuse, nnntpd_reject, \
  985.         percent_accpt, e_hours, e_min, e_sec);
  986.     }
  987.  
  988.     ##  Innxmit statistics.
  989.     if (innxmit) {
  990.     printf("Articles sent by innxmit\n");
  991.     printf("System                Offrd   Took   Toss  Fail  Pct   Elapsed       CPU  Pct\n");
  992.  
  993.     for ( ; ; ) {
  994.         s = invalid;
  995.         for (sortindex in innxmit_site)
  996.         if (innxmit_offered[sortindex] >= 0 && sortindex < s)
  997.             s = sortindex;
  998.             if (s == invalid)
  999.         break;
  1000.  
  1001.         we_offered = innxmit_offered[s];
  1002.         if (we_offered == 0)
  1003.         we_offered = 1;
  1004.         they_take = (innxmit_accepted[s] * 100.0) / we_offered;
  1005.         e_hours = innxmit_times_elapsed[s] / 3600;
  1006.         e_sec   = innxmit_times_elapsed[s] % 3600;
  1007.         e_min   = e_sec / 60;
  1008.         e_sec   %= 60;
  1009.         c_hours = (innxmit_times_user[s] + innxmit_times_sys[host]) / 3600;
  1010.         c_sec   = (innxmit_times_user[s] + innxmit_times_sys[s]) % 3600;
  1011.         c_min   = c_sec / 60;
  1012.         c_sec   %= 60;
  1013.         elapsed = innxmit_times_elapsed[s];
  1014.         if (elapsed == 0)
  1015.         elapsed = 1;
  1016.         pct = ((innxmit_times_user[s] + innxmit_times_sys[s]) * 100.0) / elapsed;
  1017.  
  1018.         printf("%-20.20s %6d %6d %6d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n", \
  1019.         s, innxmit_offered[s], innxmit_accepted[s], \
  1020.         innxmit_rejected[s], innxmit_failed[s], they_take, \
  1021.         e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  1022.  
  1023.         ixmt        += innxmit_offered[s];
  1024.         ixmt_accept += innxmit_accepted[s];
  1025.         ixmt_reject += innxmit_rejected[s];
  1026.         ixmt_failed += innxmit_failed[s];
  1027.         ixmt_ela    += innxmit_times_elapsed[s];
  1028.         ixmt_cpu    += innxmit_times_user[s] + innxmit_times_sys[s];
  1029.  
  1030.         innxmit_offered[s] = -1;
  1031.     }
  1032.  
  1033.     we_offered = ixmt;
  1034.     if (we_offered == 0)
  1035.         we_offered = 1;
  1036.     they_take = (ixmt_accept * 100) / we_offered;
  1037.     e_hours = ixmt_ela / 3600;
  1038.     e_sec   = ixmt_ela % 3600;
  1039.     e_min   = e_sec / 60;
  1040.     e_sec   %= 60;
  1041.     c_hours = ixmt_cpu / 3600;
  1042.     c_sec   = ixmt_cpu % 3600;
  1043.     c_min   = c_sec / 60;
  1044.     c_sec   %= 60;
  1045.     if (ixmt_ela == 0)
  1046.         ixmt_ela = 1;
  1047.     pct = (ixmt_cpu * 100.0) / ixmt_ela;
  1048.  
  1049.     printf("\n%-20.20s %6d %6d %6d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n\n", \
  1050.         "TOTALS", ixmt, ixmt_accept, ixmt_reject, ixmt_failed, \
  1051.         they_take, e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  1052.  
  1053.     printf("\n");
  1054.     printf("Transmission Connection Attempts         ------errors-------------------\n");
  1055.     printf("System               Conn   Ok Auth Load Space Expire Connct Other   Pct\n");
  1056.     for ( ; ; ) {
  1057.         s = invalid;
  1058.         for (sortindex in innxmit_site)
  1059.         if (innxmit_site[sortindex] >= 0 && sortindex < s)
  1060.             s = sortindex;
  1061.             if (s == invalid)
  1062.         break;
  1063.  
  1064.         tot = innxmit_site[s];
  1065.         if (tot == 0)
  1066.             tot = 1;
  1067.         errs = innxmit_afail_host[s] + innxmit_hiload[s] + \
  1068.         innxmit_nospace[s] + innxmit_cfail_host[s] + \
  1069.         innxmit_expire[s] + innxmit_crefused[s];
  1070.         ok = (innxmit_site[s] - errs);
  1071.  
  1072.         printf("%-20.20s %4d %4d %4d %4d %5d  %5d  %5d %5d   %3d%%\n", \
  1073.         s, innxmit_site[s], ok, innxmit_afail_host[s], \
  1074.         innxmit_hiload[s], innxmit_nospace[s], innxmit_expire[s], \
  1075.         innxmit_cfail_host[s], innxmit_crefused[s], \
  1076.         (100.0 * ok / tot));
  1077.  
  1078.         ict_tot += innxmit_site[s];
  1079.         ict_ok  += ok;
  1080.         ict_afail += innxmit_afail_host[s];
  1081.         ict_hiload += innxmit_hiload[s];
  1082.         ict_nospace += innxmit_nospace[s];
  1083.         ict_expire += innxmit_expire[s];
  1084.         ict_crefused += innxmit_crefused[s];
  1085.         ict_cfail += innxmit_cfail_host[s];
  1086.  
  1087.         innxmit_site[s] = -1;
  1088.     }
  1089.     tot = ict_tot;
  1090.     if (tot == 0)
  1091.         tot = 1;
  1092.     errs = ict_afail + ict_nospace + ict_hiload + ict_cfail + ict_crefused;
  1093.  
  1094.     printf("\n%-20.20s %4d %4d %4d %4d %5d  %5d  %5d %5d   %3d%%\n\n", \
  1095.         "TOTALS", ict_tot, ict_ok, ict_afail, ict_hiload, \
  1096.         ict_nospace, ict_expire, ict_cfail, ict_crefused, \
  1097.         (100.0 * ict_ok / tot));
  1098.     }
  1099.  
  1100.     ##  Nntplink statistics.
  1101.     if (nntplink) {
  1102.     printf("Articles sent by nntplink\n");
  1103.     printf("System                Offrd   Took   Toss  Fail  Pct   Elapsed       CPU  Pct\n");
  1104.  
  1105.     for ( ; ; ) {
  1106.         s = invalid;
  1107.         for (sortindex in nntplink_site)
  1108.         if (nntplink_offered[sortindex] >= 0 && sortindex < s)
  1109.             s = sortindex;
  1110.             if (s == invalid)
  1111.         break;
  1112.  
  1113.         we_offered = nntplink_offered[s];
  1114.         if (we_offered == 0)
  1115.         we_offered = 1;
  1116.         they_take = (nntplink_accepted[s] * 100.0) / we_offered;
  1117.         e_hours = nntplink_times_elapsed[s] / 3600;
  1118.         e_sec   = nntplink_times_elapsed[s] % 3600;
  1119.         e_min   = e_sec / 60;
  1120.         e_sec   %= 60;
  1121.         c_hours = (nntplink_times_user[s] + nntplink_times_sys[host]) / 3600;
  1122.         c_sec   = (nntplink_times_user[s] + nntplink_times_sys[s]) % 3600;
  1123.         c_min   = c_sec / 60;
  1124.         c_sec   %= 60;
  1125.         elapsed = nntplink_times_elapsed[s];
  1126.         if (elapsed == 0)
  1127.         elapsed = 1;
  1128.         pct = ((nntplink_times_user[s] + nntplink_times_sys[s]) * 100.0) / elapsed;
  1129.  
  1130.         printf("%-20.20s %6d %6d %6d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n", \
  1131.         s, nntplink_offered[s], nntplink_accepted[s], \
  1132.         nntplink_rejected[s], nntplink_failed[s], they_take, \
  1133.         e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  1134.  
  1135.         nxmt        += nntplink_offered[s];
  1136.         nxmt_accept += nntplink_accepted[s];
  1137.         nxmt_reject += nntplink_rejected[s];
  1138.         nxmt_failed += nntplink_failed[s];
  1139.         nxmt_ela    += nntplink_times_elapsed[s];
  1140.         nxmt_cpu    += nntplink_times_user[s] + nntplink_times_sys[s];
  1141.  
  1142.         nntplink_offered[s] = -1;
  1143.     }
  1144.  
  1145.     we_offered = nxmt;
  1146.     if (we_offered == 0)
  1147.         we_offered = 1;
  1148.     they_take = (nxmt_accept * 100) / we_offered;
  1149.     e_hours = nxmt_ela / 3600;
  1150.     e_sec   = nxmt_ela % 3600;
  1151.     e_min   = e_sec / 60;
  1152.     e_sec   %= 60;
  1153.     c_hours = nxmt_cpu / 3600;
  1154.     c_sec   = nxmt_cpu % 3600;
  1155.     c_min   = c_sec / 60;
  1156.     c_sec   %= 60;
  1157.     if (nxmt_ela == 0)
  1158.         nxmt_ela = 1;
  1159.     pct = (nxmt_cpu * 100.0) / nxmt_ela;
  1160.  
  1161.     printf("\n%-20.20s %6d %6d %6d %5d %3d%% %3d:%02d:%02d %3d:%02d:%02d %3d%%\n\n", \
  1162.         "TOTALS", nxmt, nxmt_accept, nxmt_reject, nxmt_failed, \
  1163.         they_take, e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  1164.  
  1165.     printf("Transmission Connection Attempts         ------errors-------\n");
  1166.     printf("System               Conn   Ok EOF Sock Load Bpipe Space  Exp Auth Other  Pct\n");
  1167.     for ( ; ; ) {
  1168.         s = invalid;
  1169.         for (sortindex in nntplink_site)
  1170.         if (nntplink_site[sortindex] >= 0 && sortindex < s)
  1171.             s = sortindex;
  1172.             if (s == invalid)
  1173.         break;
  1174.  
  1175.         tot = nntplink_site[s];
  1176.         if (tot == 0)
  1177.         tot = 1;
  1178.         errs = nntplink_eof[s] + nntplink_sockerr[s] + \
  1179.          nntplink_hiload[s] + nntplink_bpipe[s] + \
  1180.          nntplink_nospace[s] + nntplink_auth[s] + \
  1181.          nntplink_expire[s] + nntplink_fail[s];
  1182.         ok = (nntplink_site[s] - errs);
  1183.  
  1184.         printf("%-20.20s %4d %4d %3d %4d %4d %5d %5d %4d %4d %5d  %3d%%\n", \
  1185.         s, nntplink_site[s], ok, nntplink_eof[s], \
  1186.         nntplink_sockerr[s], nntplink_hiload[s], \
  1187.         nntplink_bpipe[s], nntplink_nospace[s], \
  1188.         nntplink_expire[s], nntplink_auth[s], nntplink_fail[s], \
  1189.         (100.0 * ok / tot));
  1190.  
  1191.         ct_tot += nntplink_site[s];
  1192.         ct_ok  += ok;
  1193.         ct_eof += nntplink_eof[s];
  1194.         ct_sockerr += nntplink_sockerr[s];
  1195.         ct_hiload += nntplink_hiload[s];
  1196.         ct_bpipe += nntplink_bpipe[s];
  1197.         ct_nospace += nntplink_nospace[s];
  1198.         ct_auth += nntplink_auth[s];
  1199.         ct_expire += nntplink_expire[s];
  1200.         ct_fail += nntplink_fail[s];
  1201.  
  1202.         nntplink_site[s] = -1;
  1203.     }
  1204.     tot = ct_tot;
  1205.     if (tot == 0)
  1206.         tot = 1;
  1207.  
  1208.     printf("\n%-20.20s %4d %4d %3d %4d %4d %5d %5d %4d %4d %5d  %3d%%\n\n", \
  1209.         "TOTALS", ct_tot, ct_ok, ct_eof, ct_sockerr, ct_hiload, \
  1210.         ct_bpipe, ct_nospace, ct_expire, ct_auth, ct_fail, \
  1211.         (100.0 * ct_ok / tot));
  1212.     }
  1213.  
  1214.     ##  Batcher statistics.
  1215.     if (batcher) {
  1216.     printf("UUCP batches created\n");
  1217.     printf("System                Offrd   Arts      Bytes   Elapsed       Cpu  Pct\n");
  1218.  
  1219.     for ( ; ; ) {
  1220.         s = invalid;
  1221.         for (sortindex in batcher_site)
  1222.         if (batcher_site[sortindex] >= 0 && sortindex < s)
  1223.             s = sortindex;
  1224.             if (s == invalid)
  1225.         break;
  1226.  
  1227.         e_hours = batcher_times_elapsed[s] / 3600;
  1228.         e_sec   = batcher_times_elapsed[s] % 3600;
  1229.         e_min   = e_sec / 60;
  1230.         e_sec   %= 60;
  1231.         c_hours = (batcher_times_user[s] + batcher_times_sys[s]) / 3600;
  1232.         c_sec   = (batcher_times_user[s] + batcher_times_sys[s]) % 3600;
  1233.         c_min   = c_sec / 60;
  1234.         c_sec   %= 60;
  1235.         elapsed = batcher_times_elapsed[s];
  1236.         if (elapsed == 0)
  1237.         elapsed = 1;
  1238.         pct = ((batcher_times_user[s] + batcher_times_sys[s]) * 100.0) / elapsed;
  1239.  
  1240.         printf("%-20.20s %6d %6d %10d %3d:%02d:%02d %3d:%02d:%02d %3d%%\n",\
  1241.         s, batcher_num[s], batcher_articles[s], batcher_bytes[s], \
  1242.         e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  1243.  
  1244.         nbatch          += batcher_num[s];
  1245.         nbatch_articles += batcher_articles[s];
  1246.         nbatch_bytes    += batcher_bytes[s];
  1247.         nbatch_ela      += batcher_times_elapsed[s];
  1248.         nbatch_cpu      += batcher_times_user[s] + batcher_times_sys[s];
  1249.  
  1250.         batcher_site[s] = -1;
  1251.     }
  1252.  
  1253.     e_hours = nbatch_ela / 3600;
  1254.     e_sec   = nbatch_ela % 3600;
  1255.     e_min   = e_sec / 60;
  1256.     e_sec   %= 60;
  1257.     c_hours = nbatch_cpu / 3600;
  1258.     c_sec   = nbatch_cpu % 3600;
  1259.     c_min   = c_sec / 60;
  1260.     c_sec   %= 60;
  1261.     if (nbatch_ela == 0)
  1262.         nbatch_ela = 1;
  1263.     pct = (nbatch_cpu * 100.0) / nbatch_ela;
  1264.  
  1265.     printf("\n%-20.20s %6d %6d %10d %3d:%02d:%02d %3d:%02d:%02d %3d%%\n\n",\
  1266.         "TOTALS", nbatch, nbatch_articles, nbatch_bytes,\
  1267.         e_hours, e_min, e_sec, c_hours, c_min, c_sec, pct);
  1268.     }
  1269.  
  1270.     ##  Rnews statistics.
  1271.     if (rnews_host) {
  1272.     printf("Rnews articles offered from:\n");
  1273.     for ( ; ; ) {
  1274.         s = invalid;
  1275.         for (sortindex in rnews_hosts)
  1276.         if (rnews_hosts[sortindex] >= 0 && sortindex < s)
  1277.             s = sortindex;
  1278.             if (s == invalid)
  1279.         break;
  1280.  
  1281.         printf("\t%6d\t%s\n", rnews_hosts[s], s);
  1282.  
  1283.         rnews_hosts[s] = -1;
  1284.         }
  1285.     printf("\n");
  1286.     }
  1287.     if (rnews_rejects) {
  1288.     printf("Rnews connections rejected %d times\n", rnews_rejects);
  1289.     for ( ; ; ) {
  1290.         s = invalid;
  1291.         for (sortindex in rnews_r_reject)
  1292.         if (rnews_r_reject[sortindex] >= 0 && sortindex < s)
  1293.             s = sortindex;
  1294.             if (s == invalid)
  1295.         break;
  1296.  
  1297.         printf("\t%6d\t%s\n", rnews_r_reject[s], s);
  1298.  
  1299.         rnews_r_reject[s] = -1;
  1300.         }
  1301.     printf("\n");
  1302.     }
  1303.     if (rnews_bad) {
  1304.     printf("Rnews bad articles: (Total %d)\n", rnews_bad);
  1305.     if (rnews_bad_ng) {
  1306.         printf("Bad newsgroup: %d\n", rnews_bad_ng);
  1307.         for ( ; ; ) {
  1308.         s = invalid;
  1309.         for (sortindex in rnews_bng)
  1310.             if (rnews_bng[sortindex] >= 0 && sortindex < s)
  1311.             s = sortindex;
  1312.                 if (s == invalid)
  1313.             break;
  1314.  
  1315.         printf("\t%5d: %s\n", rnews_bng[s], s);
  1316.  
  1317.         rnews_bng[s] = -1;
  1318.             }
  1319.     }
  1320.     if (rnews_bad_dist) {
  1321.         printf("Bad distribution: %d\n", rnews_bad_dist);
  1322.         for ( ; ; ) {
  1323.         s = invalid;
  1324.         for (sortindex in rnews_bdist)
  1325.             if (rnews_bdist[sortindex] >= 0 && sortindex < s)
  1326.             s = sortindex;
  1327.                 if (s == invalid)
  1328.             break;
  1329.  
  1330.         printf("\t%5d: %s\n", rnews_bdist[s], s);
  1331.  
  1332.         rnews_bdist[s] = -1;
  1333.             }
  1334.     }
  1335.     if (rnews_bad_date) {
  1336.         printf("Bad date: %d\n", rnews_bad_date);
  1337.     }
  1338.     printf("\n");
  1339.     }
  1340.  
  1341.     ##  NNRP statistics.
  1342.     if (nnrp) {
  1343.     printf("NNRP readership statistics\n");
  1344.     printf("System                Conn Articles Groups Post  Rej   Elapsed       CPU  Pct\n");
  1345.  
  1346.     for ( ; ; ) {
  1347.         s = invalid;
  1348.         for (sortindex in nnrp_connect)
  1349.         if (nnrp_connect[sortindex] >= 0 && sortindex < s)
  1350.             s = sortindex;
  1351.             if (s == invalid)
  1352.         break;
  1353.  
  1354.        ##  Report curious pokers elsewhere.
  1355.         if (nnrp_groups[s] == 0    \
  1356.          && nnrp_articles[s] == 0    \
  1357.          && nnrp_posts[s] == 0) {
  1358.         nnrp_curious[s] += nnrp_connect[s];
  1359.         curious = 1;
  1360.         nnrp_connect[s] = -1;
  1361.         continue;
  1362.         }
  1363.  
  1364.         nconn += nnrp_connect[s];
  1365.         nart += nnrp_articles[s];
  1366.         ngrp += nnrp_groups[s];
  1367.         npost += nnrp_posts[s];
  1368.         nrej += nnrp_rejected[s];
  1369.         ncpu += (nnrp_times_user[s] + nnrp_times_sys[s]);
  1370.         nela += nnrp_times_elapsed[s];
  1371.         e_hours      = nnrp_times_elapsed[s] / 3600;
  1372.         e_sec        = nnrp_times_elapsed[s] % 3600;
  1373.         e_min        = e_sec / 60;
  1374.         e_sec        %= 60;
  1375.         c_hours      = (nnrp_times_user[s] + nnrp_times_sys[s]) / 3600;
  1376.         c_sec        = (nnrp_times_user[s] + nnrp_times_sys[s]) % 3600;
  1377.         c_min        = c_sec / 60;
  1378.         c_sec        %= 60;
  1379.         elapsed = nnrp_times_elapsed[s];
  1380.         if (elapsed == 0)
  1381.         elapsed = 1;
  1382.         pct = ((nnrp_times_user[s] + nnrp_times_sys[s]) * 100.0) / elapsed;
  1383.  
  1384.         printf("%-20.20s %5d %8d %6d %4d %4d %3d:%02d:%02d %3d:%02d:%02d %3d%%\n",\
  1385.         s, nnrp_connect[s], nnrp_articles[s], nnrp_groups[s],\
  1386.         nnrp_posts[s], nnrp_rejected[s], e_hours, e_min, e_sec,\
  1387.         c_hours, c_min, c_sec, pct);
  1388.  
  1389.             nnrp_connect[s] = -1;
  1390.     }
  1391.  
  1392.     e_hours      = nela / 3600;
  1393.     e_sec        = nela % 3600;
  1394.     e_min        = e_sec / 60;
  1395.     e_sec        %= 60;
  1396.     c_hours      = ncpu / 3600;
  1397.     c_sec        = ncpu % 3600;
  1398.     c_min        = c_sec / 60;
  1399.     c_sec        %= 60;
  1400.     if (nela == 0)
  1401.         nela = 1;
  1402.     pct = (ncpu * 100.0) / nela;
  1403.  
  1404.     printf("\n%-20.20s %5d %8d %6d %4d %4d %3d:%02d:%02d %3d:%02d:%02d %3d%%\n\n",\
  1405.         "TOTALS", nconn, nart, ngrp, npost, nrej, e_hours, e_min, \
  1406.         e_sec, c_hours, c_min, c_sec, pct);
  1407.     }
  1408.  
  1409.     ##  Miscellaneous NNRP statistics.
  1410.     if (curious) {
  1411.     printf("Curious NNRP server explorers\n");
  1412.     printf("System                Conn\n");
  1413.     for ( ; ; ) {
  1414.         s = invalid;
  1415.         for (sortindex in nnrp_curious)
  1416.         if (nnrp_curious[sortindex] >= 0 && sortindex < s)
  1417.             s = sortindex;
  1418.             if (s == invalid)
  1419.         break;
  1420.  
  1421.         printf("%-20.20s %5d\n", s, nnrp_curious[s]);
  1422.  
  1423.         nnrp_curious[s] = -1;
  1424.         }
  1425.     printf("\n");
  1426.     }
  1427.     if (nnrp_noperms) {
  1428.     printf("NNRP no permission clients\n");
  1429.     printf("System                Conn\n");
  1430.     for ( ; ; ) {
  1431.         s = invalid;
  1432.         for (sortindex in nnrp_noperm)
  1433.         if (nnrp_noperm[sortindex] >= 0 && sortindex < s)
  1434.             s = sortindex;
  1435.             if (s == invalid)
  1436.         break;
  1437.  
  1438.         printf("%-20.20s %5d\n", s, nnrp_noperm[s]);
  1439.  
  1440.         nnrp_noperm[s] = -1;
  1441.         }
  1442.     printf("\n");
  1443.     }
  1444.     if (nnrp_unrecs) {
  1445.     printf("NNRP unrecognized commands\n");
  1446.     printf("System                Conn\n");
  1447.     for ( ; ; ) {
  1448.         s = invalid;
  1449.         for (sortindex in nnrp_unrec)
  1450.         if (nnrp_unrec[sortindex] >= 0 && sortindex < s)
  1451.             s = sortindex;
  1452.             if (s == invalid)
  1453.         break;
  1454.  
  1455.         printf("%-20.20s %5d\n", s, nnrp_unrec[s]);
  1456.  
  1457.         nnrp_unrec[s] = -1;
  1458.         }
  1459.     printf("\n");
  1460.     }
  1461.     if (nnrp_gethostfails) {
  1462.     printf("NNRP gethostbyname failures\n");
  1463.     printf("IP                    Conn\n");
  1464.     for ( ; ; ) {
  1465.         s = invalid;
  1466.         for (sortindex in nnrp_gethostfail)
  1467.         if (nnrp_gethostfail[sortindex] >= 0 && sortindex < s)
  1468.             s = sortindex;
  1469.             if (s == invalid)
  1470.         break;
  1471.  
  1472.         printf("%-20.20s %5d\n", s, nnrp_gethostfail[s]);
  1473.  
  1474.         nnrp_gethostfail[s] = -1;
  1475.         }
  1476.     printf("\n");
  1477.     }
  1478.     if (client_timeout) {
  1479.     printf("NNRP client timeouts\n");
  1480.     printf("System                Conn\n");
  1481.     for ( ; ; ) {
  1482.         s = invalid;
  1483.         for (sortindex in nnrp_timeout)
  1484.         if (nnrp_timeout[sortindex] >= 0 && sortindex < s)
  1485.             s = sortindex;
  1486.             if (s == invalid)
  1487.         break;
  1488.  
  1489.         printf("%-20.20s %5d\n", s, nnrp_timeout[s]);
  1490.  
  1491.         nnrp_timeout[s] = -1;
  1492.         }
  1493.     printf("\n");
  1494.     }
  1495.     if (server_timeout) {
  1496.     printf("NNTPLINK remote server timeouts\n");
  1497.     printf("System                Conn\n");
  1498.     for ( ; ; ) {
  1499.         s = invalid;
  1500.         for (sortindex in nntplink_timeout)
  1501.         if (nntplink_timeout[sortindex] >= 0 && sortindex < s)
  1502.             s = sortindex;
  1503.             if (s == invalid)
  1504.         break;
  1505.  
  1506.         printf("%-20.20s %5d\n", s, nntplink_timeout[s]);
  1507.  
  1508.         nntplink_timeout[s] = -1;
  1509.         }
  1510.     printf("\n");
  1511.     }
  1512.  
  1513.     ##  MTHREADS statistics.
  1514.     if (mthreads) {
  1515.     printf("Mthreads:   Starts   Groups on  Groups off    Articles     Expired\n");
  1516.     printf("%18d%12d%12d%12d%12d\n", mthreads_started, mthreads_turned_on, \
  1517.         mthreads_turned_off, mthreads_added, mthreads_expired);
  1518.     printf("\n");
  1519.     }
  1520.  
  1521.     ##  Group readership statistics.
  1522.     if (nnrp_readers) {
  1523.     for (g in nnrp_group_request) {
  1524.         x = length(g);
  1525.         if (x > max)
  1526.         max = x;
  1527.         i = index(g, ".");
  1528.         if (i > 0)
  1529.         top = substr(g, 1, i - 1);
  1530.         else
  1531.         top = g;
  1532.         category[top] += nnrp_group_request[g];
  1533.     }
  1534.     fmt = sprintf("%%-%ds %%5d\n", max);
  1535.  
  1536.     printf("Newsgroup request counts (by category)\n");
  1537.     for ( ; ; ) {
  1538.         s = invalid;
  1539.         for (sortindex in category)
  1540.         if (category[sortindex] >= 0 && sortindex < s)
  1541.             s = sortindex;
  1542.             if (s == invalid)
  1543.         break;
  1544.  
  1545.         printf(fmt, s, category[s]);
  1546.  
  1547.         category[s] = -1;
  1548.         }
  1549.     printf("\n");
  1550.  
  1551.     printf("Newsgroup request counts (by newsgroup)\n");
  1552.     for ( ; ; ) {
  1553.         s = invalid;
  1554.         for (sortindex in nnrp_group_request)
  1555.         if (nnrp_group_request[sortindex] >= 0 && sortindex < s)
  1556.             s = sortindex;
  1557.             if (s == invalid)
  1558.         break;
  1559.  
  1560.         printf(fmt, s, nnrp_group_request[s]);
  1561.  
  1562.         nnrp_group_request[s] = -1;
  1563.         }
  1564.     printf("\n");
  1565.     }
  1566.  
  1567.     printf("\n");
  1568. }
  1569.